<?php

class status_FriendshipController extends Zend_Controller_Action
{
  function init() {
  	//$this->view->headLink()->appendStylesheet($this->view->baseUrl().'/ressources/status/style.css');
  }
  
  //publish a status for the user
  function createAction() {
    //We get the status of the user
	$pseudo = $this->_getParam('pseudo');
	$engine = Myzen_Oauth_Query_Singleton::getInstance();    
    $data = $engine->query('status','friendship','create',array('userPseudo' => $pseudo));
	$result = unserialize($data);
	
	if($result['status'] == 'OK') $this->view->messageDisplay()->setMessage('Friendship created','confirmation');
	else echo $this->view->messageDisplay()->setMessage($result['error']['message'],'error');
	
	$this->_forward('user','index');
	
	
  } //end createAction

  
    //delete the relationship between 2 users
  function deleteAction() {
    //We get the status of the user
	$pseudo = $this->_getParam('pseudo');
	$engine = Myzen_Oauth_Query_Singleton::getInstance();    
    $data = $engine->query('status','friendship','delete',array('userPseudo' => $pseudo));
	$result = unserialize($data);
	
	if($result['status'] == 'OK') $this->view->messageDisplay()->setMessage('Friendship deleted','confirmation');
	else echo $this->view->messageDisplay()->setMessage($result['error']['message'],'error');
	
	$this->_forward('user','index');
	
	
  } //end createAction

  
} //End class